package Thread.New.线程组;

public class GroupTest {
    public static void main(String[] args) {
        ThreadGroup threadGroup = new ThreadGroup("A_group");
        //创建线程
        Thread threadA = new Thread(threadGroup, new RunnableImpl(), "线程A");
        Thread threadB = new Thread(threadGroup, new RunnableImpl(), "线程B");
        threadA.start();
        threadB.start();
    }
}

class RunnableImpl implements Runnable{

    @Override
    public void run() {
        System.out.println("----------------");
        System.out.println(Thread.currentThread().getName()+"线程开始执行ing");
        System.out.println("当前线程的名称为"+Thread.currentThread().getName());
        System.out.println("当前线程所在的线程组为"+Thread.currentThread().getThreadGroup().getName());
        System.out.println("----------------");
    }
}